import Vue from 'vue'
import VueRouter from 'vue-router'
// 引入
/* import NProgress from 'nprogress'
import 'nprogress/nprogress.css' */
Vue.use(VueRouter)

const routes = [
	{ path: '/', redirect: '/login' },
	{
		path: '/login',
		name: 'login',
		// route level code-splitting
		// this generates a separate chunk (about.[hash].js) for this route
		// which is lazy-loaded when the route is visited.
		component: () => import(/* webpackChunkName: "login" */ '../views/login.vue')
	},
	{
		path: '/register',
		name: 'register',
		component: () => import(/* webpackChunkName: "register" */ '../views/register.vue')
	},
	{
		path: '/index',
		name: 'index',
		component: () => import(/*webpackChunkName:"index" */ '../views/index.vue')
	},
	{
		path: '/table',
		name: 'table',
		component: () => import(/*webpackChunkName:"table" */ '../views/table.vue')
	}
]
const router = new VueRouter({
	routes
})
/* // 进度条配置项这样写
NProgress.configure({
	showSpinner: false
})
// 路由跳转前钩子函数中 - 执行进度条开始加载
router.beforeEach((to, from, next) => {
	NProgress.start()
})
// 路由跳转后钩子函数中 - 执行进度条加载结束
router.afterEach(() => {
	NProgress.done()
}) */

export default router
